Skip to content

fix: API Docs link breaks under ingress prefix without trailing slash#3

Open
ypriverol wants to merge 1 commit intomainfrom
claude/fix-docs-link-prod
Open

fix: API Docs link breaks under ingress prefix without trailing slash#3
ypriverol wants to merge 1 commit intomainfrom
claude/fix-docs-link-prod

Conversation

@ypriverol
Copy link
Copy Markdown
Contributor

Summary

When deployed at https://www.ebi.ac.uk/pride/services/sdrf-validator (no trailing slash), the API Docs link in the page footer points to /pride/services/docs instead of /pride/services/sdrf-validator/docs.

Root cause

static/index.html had a relative anchor:

<a class="lnk-green" href="docs" target="_blank">📂 API Docs</a>

The browser resolves href="docs" against window.location. With no trailing slash, the last path segment (sdrf-validator) is treated as a "file" and dropped, so docs resolves against the parent directory.

The page already has a computeApiBase() helper that normalises the path with a trailing slash for fetch calls — this PR reuses it to set the docs link at runtime.

Change

  • Add id="api-docs-link" to the anchor.
  • After baseUrl is computed, set docsLink.href = apiUrl('docs') so the link is always an absolute URL anchored at the (trailing-slash-normalised) base.

Works in all three deployment shapes:

Page URL Resolved docs link
http://localhost:8000/ http://localhost:8000/docs
https://www.ebi.ac.uk/pride/services/sdrf-validator/ …/sdrf-validator/docs
https://www.ebi.ac.uk/pride/services/sdrf-validator (was broken) …/sdrf-validator/docs

Test plan

  • Local: open /, click API Docs → lands on /docs.
  • Production-like: deploy with ROOT_PATH=/pride/services/sdrf-validator, visit the URL without trailing slash, click API Docs → lands on /pride/services/sdrf-validator/docs.
  • Same as above with trailing slash → still works.
  • Page-level fetches (/templates, /validate) still resolve correctly (unchanged code path, regression check).

https://claude.ai/code/session_01YDvKh2KVn8BpyMB1gk4yFo


Generated by Claude Code

…ixes

The raw href="docs" resolved against window.location, which drops the
last path segment when the page URL has no trailing slash. Visiting
https://www.ebi.ac.uk/pride/services/sdrf-validator pointed the docs
link at /pride/services/docs instead of
/pride/services/sdrf-validator/docs. Reuse the existing apiUrl() helper
(which guarantees a trailing-slash base) to set the href at runtime.
@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@ypriverol has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 36 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2e8e9b14-83bd-499f-b2d0-d49d1852542d

📥 Commits

Reviewing files that changed from the base of the PR and between 0b72e3e and 144c654.

📒 Files selected for processing (1)
  • static/index.html
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-docs-link-prod

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 16 minutes and 36 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@ypriverol ypriverol requested a review from selvaebi April 30, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants